﻿@{
    ViewBag.Title = "search";
}

<div id="cphMain_ctl00_ContentPane" class="center">
<style type="text/css">
.InfoMessage{ background: #EFF8FA; color: #555555; margin-bottom: 10px; padding: 6px; padding-bottom: 1px; }
.InfoMessage p{ line-height: 1.3; margin-bottom: 15px; }
.listing-type-list .disable{ display: none; }
</style>

    <div id="Breadcrumb" class="Breadcrumb">
        <ul>
            <li class="first">
                <a href='javascript:;' onclick="javascript:loadAction('Index2','Main')">Trang chủ
                </a>
            </li>
            <li>
                <a href='javascript:;' onclick="javascript:loadAction('show2','Main')">Sản phẩm</a>
            </li>
            <li>
                <span>Tìm kiếm sản phẩm</span>
            </li>
        </ul>
    </div>

<div class="ProductListContainer ListItems DefaultModule">
    
    <div class="category-title defaultTitle productlist-title">
        <h1>
            Tìm kiếm sản phẩm</h1>
    </div>
    <div class="TopContent">
        
    </div>
    <div id="ProductList" class="defaultContent listing-type-list productlist-content catalog-listing">
        
        <div class="InfoMessage">
            <p>
                Kết quả tìm kiếm cho từ khóa "<strong>@Request.QueryString["key"] @Request.Form["key"]</strong>"</p>
        </div>
        @foreach(var pro in @ViewBag.productList)
        {
                <div class="listing-item">
                    <div class="product-image ProductImageTooltip">
                        <a ="javascript:;" onclick="javascript:viewProduct(@pro.ID)" rel="1577703" class="#tooltip1577703" 
                            productname="@pro.name" 
                            description=" " 
                            thumbnail="/Content/data/images/350.300/@pro.image_link" 
                            thumbnailerror="/Content/data/images/not_available.jpg" promotion="">
                            <img src="/Content/data/images/350.300/@pro.image_link" 
                                alt="@pro.name" height="100"
                                title="@pro.name" 
                                onerror="/Content/data/images/not_available.jpg">
                        </a>
                    </div>
                    @if (pro.promotion_ID > 0)
                    {
                    <div class="saleFlag1 iconSprite ">
                        @pro.Promotion.rate<span>%</span></div>
                    }
                    <div class="product-shop">
                        <h3>
                            <a ="javascript:;" onclick="javascript:viewProduct(@pro.ID)">
                                @pro.name<span class="#tooltipPromotion1577703"><span class="Flag-Promotion">&nbsp;</span></span></a>
                        </h3>
                        <div class="description">
                            <div class="ProductRating Rating-1" style="display: ;">
                                <div class="RatingImage">
                                </div>
                            </div>
                            <div>
                                @pro.amount @pro.type x @pro.volume ml
                            </div>
                            
                        </div>
                        <div class="price">
                            @if(pro.promotion_ID > 0)
                            {
                            <div class="" style="display: ">
                                <span>Giá cũ</span>&nbsp;<span><strike class="RetailPriceValue">
                                    @pro.price.ToString("0,0") VND / thùng</strike>
                                </span>
                            </div>
                                var newPrice = pro.price / 100 * (100 - pro.Promotion.rate);
                            <div>
                                <span>Giá mới</span>&nbsp;<span><em>
                                    @newPrice.ToString("0,0") VND / thùng</em>
                                </span>
                            </div>
                            }else
                            {
                                <div>
                                <span>Giá bán</span>&nbsp;<span><em>
                                    @pro.price.ToString("0,0") VND / thùng</em>
                                </span>
                            </div>
                            }
                            <div>
                                <div class="ProductActionAdd">
                                    <a href="javascript:;" onclick="javascript:addWishlist(@pro.ID,'@Session["username"]')"><span>Thích</span></a>
                                    <a href="javascript:;" onclick="javascript:addProToCart(@pro.ID,1);"><span>Mua hàng</span></a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <hr class="clear">
                </div>
        }               
        
        <div class="clear">
        </div>
        
        <div class="clear"></div>
        
    </div>
    <div class="clear defaultFooter productlist-footer">
        <div>
        </div>
    </div>
</div>

<div id="productReviewPopup190313" class="hidden"></div>
<script type="text/javascript">
$j(function () {
    $j("#ProductList .ProductImageTooltip a").each(function () {
        var productname = $j(this).attr("productname");
        var thumbnail = $j(this).attr("thumbnail");
        var thumbnailerror = $j(this).attr("thumbnailerror");
        var description = $j(this).attr("description");
        var promotion = $j(this).attr("promotion");
        $j(this).bind("mouseover", function () {
            var promotionHtml = "";
            if (promotion != "") promotionHtml = "<div class=\"promotion-description\">" + promotion + "</div>";
            var returnHtml =
                "<div class=\"tooltip_name\">" + productname + '</div>' +
                "<div class=\"tooltip_picture\"><img src=\"" + thumbnail + "\" onerror=\"this.src='" + thumbnailerror + "'\" title=\"" + productname + "\" alt=\"" + productname + "\" /></div>" +
                "<div class=\"tooltip_description\">" + description + "</div>" +
                promotionHtml +
                "<div class=\"teaser\"></div>";
            $j("#productReviewPopup190313").html(returnHtml);
        });
        $j(this).tooltip({
            track: true, delay: 50, showURL: false,
            bodyHandler: function () {
                return $j("#productReviewPopup190313").html();
            }
        });
    });
});
</script>
</div>
